<template>
  <div id="order-list">
    <c-title text="订单列表"></c-title>
    <div class="search-box">
      <van-popover v-model="showPopover" trigger="click" :actions="actions" @select="onSelect" :offset="[5,8]">
        <template #reference>
          {{search_column.text}}
          <van-icon name="arrow-up" v-show="showPopover"/>
          <van-icon name="arrow-down" v-show="!showPopover"/>
        </template>
      </van-popover>
      <div class="input-box">
        <i class="iconfont icon-a-icon_pressed"></i>
        <input type="text" placeholder="搜索订单" @input="searchData" v-model="keyword" @keyup="searchData"/>
      </div>
    </div>
    <d-list :loading="loading" :finished="finished" @load="onLoad" >
      <div class="detail" v-for="(item,index) in dataList" :key="index">
        <div class="top-order">订单号：{{item.order_sn}}</div>
        <div class="goods-list">
          <div class="member">{{item.belongs_to_member && item.belongs_to_member.nickname || '--'}}（{{item.belongs_to_member && item.belongs_to_member.mobile || '--'}}）</div>
          <div class="goods-row" v-for="(citem,cindex) in item.order_goods" :key="cindex">
            <img :src="citem.thumb" alt="">
            <div class="middle">
              <div class="goods-name"><div class="goods-name-rol">{{citem.title}}</div> <div class="goods-num">X{{citem.total}}</div></div>
              <!-- <div class="price">￥99.99</div> -->
            </div>
          </div>
          <div class="bottom-row">
            <div class="goods-pay">
              <span>共{{item.total}}件商品</span>
              <span class="pay-price-row">付款：<span class="pay-price"><span class="pay-sym">￥</span>{{item.price}}</span></span>
            </div>
            <div class="pay-time">支付时间：{{item.pay_time}}</div>
          </div>
        </div>
      </div>
    </d-list>
  </div>
</template>
<script>
import order_controller from "./order_controller";

export default order_controller;
</script>
<style>
  .van-popover__arrow {
    opacity: 0 !important;
  }
  .van-popover__action {
    width: 88px;
  }
  /* .van-popover {
    left: 12px !important;
  } */
</style>
<style lang="scss" rel="stylesheet/scss" scoped>

#order-list {
  .search-box {
    width: 100%;
    background: #fff;
    padding: 0.625rem 0.2rem 0.625rem 0.2rem;
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-bottom: solid 0.0625rem #ebebeb;

    .van-icon {
      color: #999;
    }

    .input-box {
      width: 75%;
      height: 1.875rem;
      border-radius: 1rem;
      background: #f5f5f5;
      padding: 0 0.625rem;
      display: flex;
      align-items: center;

      .iconfont {
        font-size: 1rem;
        margin: 0.1rem 0.2rem 0 0;
        color: #999;
      }

      input {
        width: 100%;
        border: none;
        margin-left: 0;
      }
    }
  }
  .detail {
    background: white;
    padding: 0.8rem;
    margin: 0.8rem;
    border-radius: 0.4rem;
    .top-order {
        font-size: 0.8rem;
        font-weight: 400;
        color: #6E6E79;
        padding-bottom: 0.6rem;
        margin-bottom: 0.8rem;
        text-align: left;
        border-bottom: 0.1rem solid #ECECEC;
    }
    .goods-list {
      .member {
        font-size: 0.9rem;
        font-weight: 400;
        color: #3B3B4A;
        margin-bottom: 0.8rem;
        text-align: left;
        line-height: 1;
      }
      .goods-row {
        display: flex;
        padding-bottom: 0.8rem;
        img {
          width: 3.6rem;
          height: 3.6rem;
          border-radius: 0.25rem;
          margin: 0;
        }
        .middle {
          margin-left: 0.6rem;
          width: 100%;
          .goods-name {
            font-size: 0.9rem;
            font-weight: 500;
            color: #3B3B4A;
            text-align: left;
            display: flex;
            justify-content: space-between;
            width: 100%;
            align-items: center;

            .goods-name-rol {
              overflow: hidden;
              text-overflow: ellipsis;
              display: -webkit-box;
              -webkit-line-clamp: 1;
              -webkit-box-orient: vertical;
              margin-right: 0.8rem;
            }

            .goods-num {
              font-size: 0.8rem;
              color: #6E6E79;
            }
          }
          .price {
            font-size: 0.75rem;
            font-weight: 400;
            color: #6E6E79;
            text-align: left;
            margin-top: 1rem;
          }
        }
      }
      .bottom-row {
        padding-top: 0.8rem;
        border-top: 0.1rem solid #ECECEC;
        .goods-pay {
          font-size: 0.85rem;
          color: #3B3B4A;
          text-align: right;
          .pay-price-row {
            margin-left: 0.8rem;
          }
          .pay-price {
            font-size: 1rem;
            font-weight: 600;
            color: #F15353;
            .pay-sym {
              font-size: 0.75rem;
            }
          }
        }
        .pay-time {
          margin-top: 0.4rem;
          font-size: 0.85rem;
          color: #3B3B4A;
          text-align: right;
        }
      }
    }
  }
}
</style>
